<!DOCTYPE html>
<title>Tests that the cue display tree has been removed properly and no crash happens.</title>
<script src="../media-controls.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video>
    <track src="captions-webvtt/captions.vtt" kind="captions" default>
</video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    video.src = "../content/test.ogv";

    video.play();
    video.oncanplaythrough = t.step_func_done(function() {
        // Empty the contents of the video element when it is ready to play.
        video.textContent = "";

        // Text track should not be rendered anymore.
        try {
          textTrackDisplayElement(video);
          assert_unreached("textTrackDisplayElement did not throw");
        } catch (e) {
        }
    });
});
</script>
